#include"process.h"

typedef void (*callback_t)(double total, double current);

double total = 1024.0;
double speed = 1.0;

// 回调函数
void DownLoad(callback_t cb)
{
    double current = 0;
    while(current <= total)
    {
        // 进度条显示
        cb(total,current);
        usleep(3000);
        current += speed;
    }
    printf("\ndownload:%.2lfMB Done\n",current);
}

void UpLoad(callback_t cb)
{
    double current = 0;
    while(current <= total)
    {
        // 进度条显示
        cb(total,current);
        usleep(3000);
        current += speed;
    }
    printf("\nupload:%.2lfMB Done\n",current);
}

int main()
{
    DownLoad(FlushProcess);
    UpLoad(FlushProcess);
    // process_v1();
    return 0;
}
